package interview.matrixmultiply;

public class MatrixMultiply {
	public int[] multiply(int[] A, int[] B, int m, int n, int k) {
		int[] result = new int[m * k];
		for(int rowR = 0; rowR < m; rowR ++) {
			for(int colR = 0; colR < k; colR++) {
				// compute result[rowR][colR]
				result[rowR * k + colR] = 0;
				for(int col = 0; col < n; col++) {
					result[rowR * k + colR] += A[n*rowR + col] * B[col * k + colR];
				}
			}
		}

		return result;
	}
}
